package iterator.television.concrete_television;

import iterator.iterator.TVIterator;
import iterator.television.Television;

public class SonyTelevision implements Television
{
    private Object[] objects = {"山西卫视","北京卫视","湖南卫视","河北卫视","内蒙古卫视","索尼官方频道"};
    public TVIterator getIterator(){
        return new SonyIterator();
    }
    public class SonyIterator implements TVIterator
    {
        private int index = 0;
        public void previous()
        {
            if(index > 0){
                index--;
            }
        }
        public void next()
        {
            if(index < objects.length){
                index++;
            }
        }
        public void setChannel(int i){
            index = i;
        }
        public Object currentChannel(){
            return objects[index];
        }
        public boolean isLast(){
            return index == objects.length;
        }
        public boolean isFirst(){
            return index==0;
        }
    }
}
